#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<stdio.h>
using namespace std;
int main()
{
	string words;
	getline(cin,words);
	for(int i=0;i<words.size();i++){
		if(words[i]>=65&&words[i]<=90){
			words[i]+=32;
		}
	}
	string sentence,str;
	getline(cin,sentence);
	sentence.push_back(' ');
	int k=0;
	int num=0;
	vector<int>vec; 
	for(int i=0;i<sentence.size();i++){

		if(sentence[i]!=' '){
			if(sentence[i]>=65&&sentence[i]<=99){
				sentence[i]+=32;
			}
			str.push_back(sentence[i]);
			if(str==words&&sentence[i+1]==' '){
				k++;
				vec.push_back(num);
			}
		}
		else{
			str="";
			num++;
		}
	}
	int pos=sentence.find(words);
	cout<<k<<endl<<pos<<endl;
	//a-97  z-122  A-65  Z-90 ' '-32
	return 0;
 } 
